{% extends "blogs/base.html" %}

{% load widgets %}

{%block extratitle %}: Blogs{% endblock %}

{% block feeds %}
    <link rel="alternate" type="application/rss+xml" 
        title="jam.slicio.us" href="http://jam.slicio.us/blogs/feeds/latest/" />
{% endblock %}

{% block blogheader %}
    <h2>Blogs</h2>
{% endblock %}

{% block blogcontent %}

    <p>Here is a list of all the blogs hosted on this website.</p>

    {% for blog in object_list %}
        <h2>{{ forloop.counter0|add:first_on_page }}. <a href="{% url blogs.main.index blog.slug %}">{{ blog.name }}</a></h2>
        <p>{{ blog.description|striptags|safe|truncatewords:30 }}</p>
    {% endfor %}
    
    {% if is_paginated %}
    <p id="post_nav">
        {% if has_previous %}<a href="?page={{ previous }}">&laquo; Previous</a>{% endif %}
        {% if has_next %}{% if has_previous %}| {% endif %}<a href="?page={{ next }}">Next&raquo;</a>{% endif %}
    </p>
    {% endif %}
{% endblock %}

{% block blogsidebar %}
    {% load_latest_posts %}
    {% if latest_posts %}
    	<div class="holder">
        <h3>Recent Posts</h3>
	        {% for post in latest_posts %}
        	    <p class="latest{% if forloop.last %} last{% endif%}">
                	<a href="{{ post.get_absolute_url }}">{{ post.title }}</a> ({{ post.pub_date|date:"m/d/y" }})<br />
	                <small>Posted in <a href="{% url blogs.main.index post.blog.slug %}">{{ post.blog.name }}</a> by {{ post.get_author.name }}</small>
        	    </p>
	        {% endfor %}
	</div>
    {% endif %}
{% endblock %}
